import 'package:flutter/material.dart';

void main() {
  runApp(new MaterialApp(
    home: Scaffold(
      appBar: AppBar(
        title: Text("Container配置说明"),
      ),
      body: Container(
          // Container 会让其child 充满自身，即使child对自身做了大小限制
          // 内容对齐方式
          alignment: Alignment.center,
          //color: Colors.amber,
          // 背景色装饰 ，如果设置 这不能设置color
          decoration: BoxDecoration(
            //color: Colors.red, //纯色填充背景
            gradient: LinearGradient(colors: <Color>[Colors.green, Colors.red]),
            //使用渐变填充背景 优先于纯色填充
            border: Border.uniform(BorderSide(
                    color: Colors.green, width: 1, style: BorderStyle.solid)
                // 描边
                /* left: BorderSide(
                  color: Colors.green, width: 1, style: BorderStyle.none),
              top: BorderSide(
                  color: Colors.red, width: 1, style: BorderStyle.solid),
              right: BorderSide(
                  color: Colors.blue, width: 1, style: BorderStyle.solid),
              bottom: BorderSide(
                  color: Colors.cyan, width: 1, style: BorderStyle.solid)*/
                ),
            borderRadius: BorderRadius.only(
                topLeft: Radius.circular(10),
                topRight: Radius.circular(30),
                bottomLeft: Radius.circular(0),
                bottomRight: Radius.circular(20)),
            /*border: Border.all(color: Colors.green,width: 1,style: BorderStyle.solid),
          borderRadius: const BorderRadius.all(Radius.circular(10.0)),*/
            /*boxShadow: <BoxShadow>[ 
            // 投影
            BoxShadow(color: Colors.black, blurRadius: 4, spreadRadius: 10)
          ],*/
            //背景混合模式
            backgroundBlendMode: BlendMode.difference,
            //背景形状 注意 这里如果设置circle 则不可以设置border
            shape: BoxShape.rectangle,
          ),
          //前景色装饰
          /**/
          foregroundDecoration: BoxDecoration(
              color: Color.fromARGB(100, Colors.yellow.red, Colors.yellow.green,
                  Colors.yellow.blue),
              shape: BoxShape.rectangle),
          // 容器长宽大小 如果未指定则充满父容器, 大小限制优先于 布局约束constraints
          //width: 400,
          //height: 400,
          // 布局约束
          constraints: BoxConstraints(
              //minWidth: 200, maxWidth: 300, minHeight: 200, maxHeight: 300
              ),
          // 边缘间距
          margin: EdgeInsets.fromLTRB(10, 20, 30, 40),
          //形状变化
          transform: Matrix4.translationValues(-10, -20, 0),

          //内容widget
          child: Container(
                  alignment: Alignment.center,
                  color: Colors.green,
                  margin: EdgeInsets.all(40),
                  constraints: BoxConstraints(),
                  child: Container(
                    color: Colors.grey,
                    margin: EdgeInsets.all(40),
                  ),
          )
      ),
    ),
  ));
}
